import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

export default defineConfig({
    resolve: {
        alias: [
            { find: '/@', replacement: path.resolve(__dirname, 'src') }
        ]
    },
    server: {
        // 代理，本地解决跨域问题
        // proxy: {
        //     '/api': {
        //         target:'/xxx你的地址',
        //         changeOrigin: true,
        //         rewrite: (path: string) => path.replace(/^\/api/, '')
        //     }
        // },
        port: 3002
    },
    build: {
        assetsDir:'static',
        sourcemap: false,
        manifest: true,
        rollupOptions: {
            output: {
                manualChunks: {
                    'element-plus': ['element-plus'],
                    echarts: ['echarts']
                }
            }
        },
        chunkSizeWarningLimit: 1000
    },
    optimizeDeps: {
        // include: ['axios', 'nprogress', 'mockjs']
    },
    plugins: [vue()],
    css: {
        postcss: {
            plugins: [
                require('autoprefixer'),
                require('tailwindcss'),
                require('postcss-nested'),
                require('postcss-simple-vars'),
                require('postcss-import')
            ]
        }
    }
})
